package com.suray.type;

/**
 * 6代车托盘状态
 */
public enum Rgv60PalletStatus {
    INVALID(-1, "无效"),
    UPING(0x00, "上升中"),
    UP_OK(0x01, "顶升完成"),
    DOWNING(0x02, "下降中"),
    DOWN_OK(0x03, "下降完成"),
    STOP(0x04, "停止"),
    CAN_GET(0x25, "可取"),
    CAN_PUT(0x26, "可放"),
    ERROR(0xFE, "异常"),
    FAIL(0xFF, "执行失败"),
    ;

    Integer value;
    String des;
    Rgv60PalletStatus(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public Integer getValue() {
        return value;
    }

    public static Rgv60PalletStatus parseStatus(Integer value) {
        if (value == null) {
            return INVALID;
        }

        for (Rgv60PalletStatus rgv60PalletStatus : Rgv60PalletStatus.values()) {
            if (rgv60PalletStatus.value.equals(value)) {
                return rgv60PalletStatus;
            }
        }

        return INVALID;
    }

    @Override
    public String toString() {
        return des;
    }
}
